package com.mall.dto;

import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * 购物车操作DTO
 * 
 * @author Mall Team
 */
@Data
public class CartOperateDTO {
    
    @NotNull(message = "商品ID不能为空")
    private Long productId;
    
    @NotNull(message = "数量不能为空")
    @Min(value = 1, message = "数量必须大于0")
    private Integer quantity;
    
    private Boolean checked = true;  // 是否选中
    
    /**
     * 添加到购物车DTO
     */
    @Data
    public static class AddToCartDTO {
        @NotNull(message = "商品ID不能为空")
        private Long productId;
        
        @NotNull(message = "数量不能为空")
        @Min(value = 1, message = "数量必须大于0")
        private Integer quantity = 1;
    }
    
    /**
     * 更新购物车DTO
     */
    @Data
    public static class UpdateCartDTO {
        @NotNull(message = "购物车ID不能为空")
        private Long cartId;
        
        @Min(value = 1, message = "数量必须大于0")
        private Integer quantity;
        
        private Boolean checked;
    }
    
    /**
     * 批量选择DTO
     */
    @Data
    public static class BatchSelectDTO {
        @NotNull(message = "选中状态不能为空")
        private Boolean checked;
        
        private Long[] cartIds;  // 为空表示全选/全不选
    }
}